package com.qianfeng.index_7005.controller;

import com.qianfeng.entity.Result;
import com.qianfeng.entity.Type;
import com.qianfeng.index_7005.service.TypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * author: 田晋宇
 * datetime:2021/11/2 15:02
 * email:853796359@qq.com
 */
@Controller
public class TypeController {

    @Autowired
    private TypeService typeService;

    @RequestMapping({"/","getTypes"})
    public String getTypes(Map map){
        List<Type> first = typeService.getFirst();
        map.put("types",first);//把数据存在request 域中

        return "index";
    }
}
